Repository navigation
Conversation
0513258 to
c442e6e
Compare
schwabe
left a comment
There was a problem hiding this comment.
I started reviewing this buit I think the PR needs a bit of overhaul in the general strategy to wherever possible to avoid the ifdefs directly in the code and instead try to use compat.hpp instead.
It seems that this PR also ignores a lot of the compat stuff that is already there for OpenSSL 1.1.x that has its own compat layer and instead adds its own distinct ifdef/compat stuff.
That generates extra code to maintain.
To be honest, this PR feels a bit like AI was used and then not really cleaned up by a human enough to make it actually good/maintainable code.
|
Thank you for the feedback. I am going to close this PR and open a different one more in line with using |
|
You could also force push to the same branch, instead of opening new PRs each time. It's less noisy and easier to follow, because we don't lose older comments. |
|
Yes. I agree with @ordex please force push to this PR and reopen it if you have a new version. |
bfd1830 to
3bbd685
Compare
3bbd685 to
799541e
Compare
|
Ack, reopened with the force pushed changes and edited the PR description. Thanks! |
|
Gentle bump @schwabe? |
|
I only did a very light review and already found multiple issues. This is a bit better but it is still feels like this has not be gone through proper human reviewing and looking at the changes if they really make sense. A lot of the changes still feel sloppy. The OpenVPN 2.x patches from your colleguage had a much better quality and that is why they were accepted with relatively small changes. I strongly suggest to review this PR yourself again or let some colleguage review it before resubmitting. |
|
@prasden are you still interested in cleanup up this PR? |
|
@schwabe -- thanks for the swift feedback. Yes, let me take a look and clean up by end of tomorrow. |
Addresses #434
Changes:
This PR adds support for building OpenVPN3 against AWS-LC as the libcrypto/libssl backend, selected by the flag
-DUSE_AWSLC=ONandCMAKE_PREFIX_PATHpointing at the AWS-LC install.For AWS-LC divergences,
openvpn/openssl/aws-lc-compat.hppwas added. AWS-LC reports itself as OpenSSL 1.1.1, so it reuses the existing OpenSSL code and the 1.1.x shims incompat.hpp.AWS-LC differences:
BIOerrmacro.aws-lc-compat.hppdefines it asOPENSSL_PUT_ERROR(BIO, r), the same way AWS-LC definesRSAerrandSSLerr.SSL_R_TLSV1_ALERT_CERTIFICATE_REQUIRED.aws-lc-compat.hppaliasesSSL_R_TLSV13_ALERT_CERTIFICATE_REQUIREDto it.SSL_R_CA_MD_TOO_WEAK,SSL_R_CA_KEY_TOO_SMALL,SSL_R_DH_KEY_TOO_SMALLorEVP_PKEY_DSA1..4. Theircaselabels are wrapped in#ifdef, like the existingSSL_R_LEGACY_SIGALG_DISALLOWED_OR_UNSUPPORTED.EVP_PKEY_TLS1_PRF.TLS1PRF::PRFhas a third variant for AWS-LC that callsCRYPTO_tls1_prf, the same as OpenVPN 2.x.SSL_CTX_set_security_leveldoes nothing. AWS-LC uses the existing branch that only acceptstls-cert-profile legacyand rejects other profiles.RSA_meth_set0_app_databut noRSA_meth_get0_app_data. The external PKI RSA class stores itsthispointer in its own ex_data index, the same wayExternalPKIECImpldoes.EC_KEY_METHOD_set_signrequiressign_setupto be NULL. The emptyecdsa_sign_setupstub is removed and NULL is passed.SSL_CIPHER_descriptionreturns aconst char *that cannot be freed without a cast. The caller now passes a stack buffer instead.EVP_EncryptUpdateorEVP_DecryptUpdategets a NULL input. The AAD update is skipped when there is no AAD.PKCS7_verifyrejects a NULLX509_STORE, even withPKCS7_NOVERIFY. The caller now passes an empty store.Testing
Built against AWS-LC and verified that all unit tests passed (591/591) and also verified OpenVPN3 was able to build against stock OpenSSL, passing all unit tests, confirming there were no regressions from the changes.
To test building against AWS-LC: see aws-lc/BUILDING.md for prerequisites
Build AWS-LC
git clone https://github.com/aws/aws-lc.git cmake -GNinja -B aws-lc/build -S aws-lc \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=aws-lc/install ninja -C aws-lc/build installBuild OpenVPN3 using AWS-LC as the SSL backend and run the tests:
cmake -B build-awslc -S . -DUSE_AWSLC=ON -DCMAKE_PREFIX_PATH=/path/to/aws-lc/install cmake --build build-awslc --target coreUnitTests ovpncli